﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;

namespace MONTRASEC_test.Classes
{
  public class UtilFillInTheTemplateOnTraffickingInHumanBeings
  {
    internal static void getInvitationToFillTemplateOnTraffickingInHumanBeings(BulletedList myBulletedList, String myID)
    {

      Boolean isNeededToFill = false;
      A_NEWENTRY_DataContext dataContext = new A_NEWENTRY_DataContext();

      //C1->event of child pornography->acts committed in the context of child pornography-Trafficking in human beings

      var data = from c in dataContext.A_NEWENTRY_s
                 where c.ID == long.Parse(myID)
                 select new
                 {
                   c.C_1_EVENT_EVENTOFCHILDPORNOGRAPHY_EVENTOFCHILDPORNOGRAPHY,
                   c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_HACKINGCOMPUTERPROTECTION,
                   c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_SEXUALASSAULT,
                   c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_RAPE,
                   c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_CHILDPROSTITUTION,
                   c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_UNDECLAREDEMPLOYMENT,
                   c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_COUNTERFEITING,
                   c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_ABDUCTION,
                   c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_KEEPINGABROTHEL,
                   c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_TRAFFICKINGINHUMANBEINGS,
                   c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_ABUSEOFPOSITION,
                   c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_ADMINISTRATIONOFDRUGS_MED,
                   c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_DECEPTIONOFTHEVICTIMINORD
                 };
      foreach (var c in data)
      {
        isNeededToFill = (Boolean)c.C_1_EVENT_EVENTOFCHILDPORNOGRAPHY_EVENTOFCHILDPORNOGRAPHY.GetValueOrDefault() && ((Boolean)c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_HACKINGCOMPUTERPROTECTION.GetValueOrDefault() ||
                   (Boolean)c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_SEXUALASSAULT.GetValueOrDefault() ||
                   (Boolean)c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_RAPE.GetValueOrDefault() ||
                   (Boolean)c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_CHILDPROSTITUTION.GetValueOrDefault() ||
                   (Boolean)c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_UNDECLAREDEMPLOYMENT.GetValueOrDefault() ||
                   (Boolean)c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_COUNTERFEITING.GetValueOrDefault() ||
                   (Boolean)c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_ABDUCTION.GetValueOrDefault() ||
                   (Boolean)c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_KEEPINGABROTHEL.GetValueOrDefault() ||
                   (Boolean)c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_TRAFFICKINGINHUMANBEINGS.GetValueOrDefault() ||
                   (Boolean)c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_ABUSEOFPOSITION.GetValueOrDefault() ||
                   (Boolean)c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_ADMINISTRATIONOFDRUGS_MED.GetValueOrDefault() ||
                   (Boolean)c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_DECEPTIONOFTHEVICTIMINORD.GetValueOrDefault());
        if (isNeededToFill)
        {
          myBulletedList.Items.Add("There is/are act(s) committed in the context of child pornography, please fill in the template on trafficking in human beings");
        }
      }

      isNeededToFill = false;

      //C1->event of sexual assault ->acts committed in the context of sexual assault->trafficking in human beings o In this case, please fill in the template on trafficking in human beings

      var data2 = from c in dataContext.A_NEWENTRY_s
                  where c.ID == long.Parse(myID)
                  select new
                  {
                    c.C_1_EVENT_EVENTOFSEXUALASSAULT_EVENTOFSEXUALASSAULT,
                    c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_RAPE,
                    c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_CHILDPROSTITUTION,
                    c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_UNDECLAREDEMPLOYMENT,
                    c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_COUNTERFEITING,
                    c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_KEEPINGABROTHEL,
                    c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_TRAFFICKINGINHUMANBEINGS,
                    c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_ABUSEOFPOSITION,
                    c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_ADMINISTRATIONOFDRUGS_MED,
                    c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_ABDUCTION,
                    c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_DECEPTIONOFTHEVICTIMINORD,
                    c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_CHILDPORNOGRAPHY,
                    c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_BRIBERY
                  };

      foreach (var c in data2)
      {
        isNeededToFill = (Boolean)c.C_1_EVENT_EVENTOFSEXUALASSAULT_EVENTOFSEXUALASSAULT.GetValueOrDefault() && (
          (Boolean)c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_RAPE.GetValueOrDefault() ||
(Boolean)c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_CHILDPROSTITUTION.GetValueOrDefault() ||
(Boolean)c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_UNDECLAREDEMPLOYMENT.GetValueOrDefault() ||
(Boolean)c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_COUNTERFEITING.GetValueOrDefault() ||
(Boolean)c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_KEEPINGABROTHEL.GetValueOrDefault() ||
(Boolean)c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_TRAFFICKINGINHUMANBEINGS.GetValueOrDefault() ||
(Boolean)c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_ABUSEOFPOSITION.GetValueOrDefault() ||
(Boolean)c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_ADMINISTRATIONOFDRUGS_MED.GetValueOrDefault() ||
(Boolean)c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_ABDUCTION.GetValueOrDefault() ||
(Boolean)c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_DECEPTIONOFTHEVICTIMINORD.GetValueOrDefault() ||
(Boolean)c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_CHILDPORNOGRAPHY.GetValueOrDefault() ||
(Boolean)c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_BRIBERY.GetValueOrDefault());
        if (isNeededToFill)
        {
          myBulletedList.Items.Add("There is/are act(s) committed in the context of sexual assault, please fill in the template on trafficking in human beings");
        }
      }





      //C1->event of sex tourism->offences committed in the context of sex tourism->trafficking in human beings o In this case, please fill in the template on trafficking in human beings

      var data3 = from c in dataContext.A_NEWENTRY_s
                  where c.ID == long.Parse(myID)
                  select new
                  { c.C_1_EVENT_EVENTOFSEXTOURISM_EVENTOFSEXTOURISM,
                    c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_RAPE,
                    c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_CHILDPROSTITUTION,
                    c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_UNDECLAREDEMPLOYMENT,
                    c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_COUNTERFEITING,
                    c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_LOCKINGUPVICTIM,
                    c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_KEEPINGABROTHEL,
                    c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_TRAFFICKINGINHUMANBEINGS,
                    c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_ABUSEOFPOSITION,
                    c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_ADMINISTRATIONOFDRUGS_MED,
                    c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_ABDUCTION,
                    c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_CHILDPORNOGRAPHY,
                    c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_BRIBERY
                  };

      foreach (var c in data3)
      {
        isNeededToFill =
          (Boolean) c.C_1_EVENT_EVENTOFSEXTOURISM_EVENTOFSEXTOURISM.GetValueOrDefault() &&(
          (Boolean)c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_RAPE.GetValueOrDefault() ||
(Boolean)c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_CHILDPROSTITUTION.GetValueOrDefault() ||
(Boolean)c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_UNDECLAREDEMPLOYMENT.GetValueOrDefault() ||
(Boolean)c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_COUNTERFEITING.GetValueOrDefault() ||
(Boolean)c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_LOCKINGUPVICTIM.GetValueOrDefault() ||
(Boolean)c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_KEEPINGABROTHEL.GetValueOrDefault() ||
(Boolean)c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_TRAFFICKINGINHUMANBEINGS.GetValueOrDefault() ||
(Boolean)c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_ABUSEOFPOSITION.GetValueOrDefault() ||
(Boolean)c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_ADMINISTRATIONOFDRUGS_MED.GetValueOrDefault() ||
(Boolean)c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_ABDUCTION.GetValueOrDefault() ||
(Boolean)c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_CHILDPORNOGRAPHY.GetValueOrDefault() ||
(Boolean)c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_BRIBERY.GetValueOrDefault());
        if (isNeededToFill)
        {
          myBulletedList.Items.Add("There is/are offence(s) committed in the context of sex tourism, please fill in the template on trafficking in human beings");
        }
      }

      //C1->event of child prostitution->offences committed in the context of child prostitution->trafficking in human beings o In this case, please fill in the template on trafficking in human beings 


      var data4 = from c in dataContext.A_NEWENTRY_s
                  where c.ID == long.Parse(myID)
                  select new
                  { c.C_1_EVENT_EVENTOFCHILDPROSTITUTION_EVENTOFCHILDPROSTITUTION,
                    c.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_RAPE,
                    c.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_UNDECLAREDEMPLOYMENT,
                    c.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_COUNTERFEITING,
                    c.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_LOCKINGUPVICTIM,
                    c.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_KEEPINGABROTHEL,
                    c.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_TRAFFICKINGINHUMANBEINGS,
                    c.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_ABUSEOFPOSITION,
                    c.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_ADMINISTRATIONOFDRUGS_MED,
                    c.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_ABDUCTION,
                    c.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_CHILDPORNOGRAPHY,
                    c.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_BRIBERY
                  };

      foreach (var c in data4)
      {
        isNeededToFill = (Boolean)c.C_1_EVENT_EVENTOFCHILDPROSTITUTION_EVENTOFCHILDPROSTITUTION.GetValueOrDefault() && 
          ((Boolean)c.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_RAPE.GetValueOrDefault() ||
(Boolean)c.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_UNDECLAREDEMPLOYMENT.GetValueOrDefault() ||
(Boolean)c.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_COUNTERFEITING.GetValueOrDefault() ||
(Boolean)c.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_LOCKINGUPVICTIM.GetValueOrDefault() ||
(Boolean)c.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_KEEPINGABROTHEL.GetValueOrDefault() ||
(Boolean)c.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_TRAFFICKINGINHUMANBEINGS.GetValueOrDefault() ||
(Boolean)c.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_ABUSEOFPOSITION.GetValueOrDefault() ||
(Boolean)c.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_ADMINISTRATIONOFDRUGS_MED.GetValueOrDefault() ||
(Boolean)c.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_ABDUCTION.GetValueOrDefault() ||
(Boolean)c.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_CHILDPORNOGRAPHY.GetValueOrDefault() ||
(Boolean)c.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_BRIBERY.GetValueOrDefault());
        if (isNeededToFill)
        {
          myBulletedList.Items.Add("There is/are offence(s) committed in the context of child prostitution, please fill in the template on trafficking in human beings");
        }
      }
    }
  }
}

